package com.njxzc.demo.service.before;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njxzc.demo.common.http.ResponseResult;
import com.njxzc.demo.entity.FocusEntity;
import com.njxzc.demo.mapper.before.FocusMapper;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Map;

@Service
public class FocusServiceImpl extends ServiceImpl<FocusMapper, FocusEntity> implements FocusService{
    @Override
    public ResponseResult<Map<String, Object>> add(FocusEntity focusEntity) {
        long res = lambdaQuery().eq(FocusEntity::getGoodstableId, focusEntity.getGoodstableId())
                .eq(FocusEntity::getBusertableId, focusEntity.getBusertableId()).count();
        if(res > 0){
            return ResponseResult.getMessageResult(null, "A002");
        }else{
            save(focusEntity);
            return ResponseResult.getMessageResult(null, "A001");
        }
    }
}
